// 建立数据库链接
const mongoose = require('mongoose');
const db = 'mongodb://1.117.154.69:27017/echart_oil_db';

mongoose.connect(db);

// /**
//   * 连接成功
//   */
// mongoose.connection.on('connected', function () {    
//     console.log('Mongoose connection open to ' + DB_URL);  
// });    

// /**
//  * 连接异常
//  */
// mongoose.connection.on('error',function (err) {    
//     console.log('Mongoose connection error: ' + err);  
// });    
 
// /**
//  * 连接断开
//  */
// mongoose.connection.on('disconnected', function () {    
//     console.log('Mongoose connection disconnected');  
// });    

module.exports = mongoose;